import Mock from 'mockjs'
/**
 * 模拟 GET 请求 '/mock/api/v1/list' 资源
 * 
 */
Mock.mock(/\/mock\/home.*/, 'post', () => {
    const num:number = parseInt(Math.random()*100000+'')
    const num2 =  parseInt(Math.random()*100 +'')
    const num3 =  parseInt(Math.random()*100 +'')
    const num4 =  parseInt(Math.random()*1000 +'')
    const data = Mock.mock({
        list:[
            {
                name: '毛利',
                data: Mock.Random.pick([1300, 1932, 2901, 4334,839,1790,3680,4923,2467],4,4),
                type: 'line',
                smooth: true,
                color: Mock.Random.hex(),
                symbol: 'none'
              },
              {
                name: '实收款',
                data: Mock.Random.pick([1300, 1932, 2901, 4334,839,1790,3680,4923,2467],4,4),
                type: 'line',
                smooth: true,
                color: Mock.Random.hex(),
                symbol: 'none'
              },
              {
                name: '预收款',
                data: Mock.Random.pick([1300, 1932, 2901, 4334,839,1790,3680,4923,2467],4,4),
                type: 'line',
                smooth: true,
                color: Mock.Random.hex(),
                symbol: 'none'
              },
              {
                name: '配送量',
                data: Mock.Random.pick([1300, 1932, 2901, 4334,839,1790,3680,4923,2467],4,4),
                type: 'line',
                smooth: true,
                color: Mock.Random.hex(),
                symbol: 'none'
              },
        ],
        headlist:[
            [
                {
                  top: num,
                  title: '一周流水收入',
                  color: 'rgb(254, 87, 34)',
                },
                {
                  top: num,
                  title: '一周营业收入',
                }
              ],
              [
                {
                  top: parseInt(num*num2/100+''),
                  title: '一周毛利',
                  color: 'orange',
                },
                {
                  top: num2+''+'%',
                  title: '毛利率',
                }
              ],
              [
                {
                  top: num4,
                  title: '一周配送量',
                  color: 'green',
                }
              ],
              [
                {
                  top: num3+''+'%',
                  title: '连续购餐率',
                  color: 'rgb(25, 158, 216)',
                }
              ],
              [
                {
                  top: parseInt(num-num*num2/100+''),
                  title: '一周流水支出',
                  color: 'rgb(75, 158, 216)',
                }
              ],
        ],
        message:'请求营收数据成功',
       })
  return {
    data,
    code:200,
    message:'请求营收数据成功',
  }
})
